package com.heking.securityapp.entiry;

import android.os.Parcel;

/**
 * @Author 35574
 * @Date 2021/10/25
 * @Description
 */
public class ParcelableA extends ParcelableParent {
    private int age;

    public ParcelableA( ) {
    }

    public ParcelableA(String name, int age) {
        super(name);
        this.age = age;
    }

    public ParcelableA(Parcel in) {
        super(in);
        age = in.readInt();
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest,flags);
        dest.writeInt(age);
    }

    public static final Creator<ParcelableA> CREATOR = new Creator<ParcelableA>() {
        @Override
        public ParcelableA createFromParcel(Parcel in) {
            return new ParcelableA(in);
        }

        @Override
        public ParcelableA[] newArray(int size) {
            return new ParcelableA[size];
        }
    };

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "ParcelableA{" +
                "name=" + getName() +","+
                "age=" + getAge() +
                '}';
    }

}
